﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using UFIDA.U8.Portal.Proxy.supports;
using UFIDA.U8.Portal.Proxy.editors;
using UFIDA.U8.Portal.Proxy.Actions;
using System.Windows.Forms;
using UFIDA.U8.Portal.Framework.Actions;
using UFSoft.U8.Framework.LoginContext;

namespace zUpLoad
{

    #region 用友登录参数传递，必须，不得更改
    //用友参数传递，必须，不得更改
    public class MyLoginable : NetLoginable
    {
        public override object CallFunction(string cMenuId, string cMenuName, string cAuthId, string cCmdLine)
        {
            try
            {
                MessageBox.Show("111");
                cSysStart.getStartParam();             
                Common.cDll.checkVer(cCmdLine);
                MyNetUserControl mycontrol =new MyNetUserControl();
                mycontrol.Title = cMenuName;
                mycontrol._dllName = cCmdLine;
                base.ShowEmbedControl(mycontrol, cCmdLine, true);
                return null;
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message + Environment.NewLine + ex.StackTrace );
            }
            return null;
            
        }
        public override bool SubSysLogin()
        {
            GlobalParameters.gLoginable = this;
            return base.SubSysLogin();
        }
    }

    public static class GlobalParameters
    {
        private static MyLoginable _myLoginable = null;
        public static MyLoginable gLoginable
        {
            get
            {
                return _myLoginable;
            }
            set
            {
                _myLoginable = value;
            }
        }
        public static UFSoft.U8.Framework.LoginContext.UserData gLoginInfo
        {
            get
            {
                return GlobalParameters.gLoginable.LoginObject.GetLoginInfo(GlobalParameters.gLoginable.LoginObject.userToken);
            }
        }
    }
    #endregion
}
